using System.Diagnostics;
using System.Windows.Controls;
using log4net;
using log4net.Core;

namespace Triton.Common.LogUtilities
{
	public static class Logger
	{
		private static readonly CustomLogger customLogger_0;

		private const string string_0 = "Hearthbuddy";

		private static Stopwatch stopwatch_0;

		public static string FileName => customLogger_0.FileName;

		public static void OpenLogFile()
		{
			if (!stopwatch_0.IsRunning)
			{
				stopwatch_0.Start();
			}
			else
			{
				if (stopwatch_0.ElapsedMilliseconds < 30000L)
				{
					return;
				}
				stopwatch_0.Restart();
			}
			try
			{
				Process.Start(FileName);
			}
			catch
			{
			}
		}

		public static ILog GetLoggerInstanceForType()
		{
			return customLogger_0.GetLoggerInstanceForType();
		}

		static Logger()
		{
			stopwatch_0 = new Stopwatch();
			customLogger_0 = new CustomLogger("Logs", "Hearthbuddy", Level.All, Level.Emergency);
		}

		public static void Clear()
		{
			customLogger_0.Clear();
		}

		public static void AddWpfListener(ScrollViewer scrollViewer, RichTextBox rtbLog)
		{
			customLogger_0.AddWpfListener(scrollViewer, rtbLog);
		}

		public static void ChangeLogFilterLevel(Level minLevel = null, Level maxLevel = null)
		{
			customLogger_0.ChangeLogFilterLevel(minLevel, maxLevel);
		}
	}
}
